package com.haochang.chunkvod.controller.activity.cash;

import com.haochang.base.BaseActivity;
import com.haochang.base.BaseTextView;
import com.haochang.base.OnBaseClickListener;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.app.common.intent.IntentKey;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

/**
 *@author qintao
 *created at 2016/7/26 12:10
 * 营业外商品详情
 */

public class NonOperatingGoodsDetailsActivity extends BaseActivity
{

	private BaseTextView tv_title;
	private BaseTextView tv_materielCodeValue;
	private BaseTextView tv_goodsNameTitle, tv_goodsNameValue;
	private BaseTextView tv_priceValue;
	private ImageView img_close;
	private RelativeLayout materielCode_div;
	private String title;
	private String materielCodeValue;
	private String goodsNameTitle;
	private String goodsNameValue;
	private String priceValue;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
	}

	@Override
	public void receiveParam()
	{
		title = getIntent().getStringExtra(IntentKey.CUSTOM_DIALOG_TITLE);
		materielCodeValue = getIntent().getStringExtra(IntentKey.MATERIELCODEVALUE);
		goodsNameTitle = getIntent().getStringExtra(IntentKey.GOODSNAMETITLE);
		goodsNameValue = getIntent().getStringExtra(IntentKey.GOODSNAMEVALUE);
		priceValue = getIntent().getStringExtra(IntentKey.PRICEVALUE);
	}

	@Override
	public void initData()
	{

	}

	@Override
	public void initViews()
	{
		setContentView(R.layout.activity_non_operating_goods_details);
		tv_title = (BaseTextView) findViewById(R.id.tv_title);
		tv_materielCodeValue = (BaseTextView) findViewById(R.id.tv_materielCodeValue);
		tv_goodsNameTitle = (BaseTextView) findViewById(R.id.tv_goodsNameTitle);
		tv_goodsNameValue = (BaseTextView) findViewById(R.id.tv_goodsNameValue);
		tv_priceValue = (BaseTextView) findViewById(R.id.tv_priceValue);
		img_close = (ImageView) findViewById(R.id.img_close);
		img_close.setOnClickListener(mOnBaseClickListener);
		materielCode_div = (RelativeLayout) findViewById(R.id.materielCode_div);
		tv_title.setText(title);
		tv_goodsNameTitle.setText(goodsNameTitle);
		tv_goodsNameValue.setText(goodsNameValue);
		tv_priceValue.setText(priceValue);
		if (TextUtils.isEmpty(materielCodeValue))
			materielCode_div.setVisibility(View.GONE);
		else
			tv_materielCodeValue.setText(materielCodeValue);
	}

	private OnBaseClickListener mOnBaseClickListener = new OnBaseClickListener()
	{
		@Override
		public void onBaseClick(View v)
		{
			switch (v.getId())
			{
			case R.id.img_close:
				finish();
				break;
			default:
				break;
			}
		}
	};
}
